//
// Created by zggua on 2025/7/16.
//

#ifndef HOME_H
#define HOME_H

#include <QWidget>
#include <QVariant>

QT_BEGIN_NAMESPACE
namespace Ui { class Home;}
QT_END_NAMESPACE



class Home : public QWidget {
    Q_OBJECT
public:
    enum IpEnum {
        // 未知
        Unknown,
        // 正常
        Normal,
        // 错误
        Error
    };
    Q_ENUM(IpEnum)

    struct IpInfo {
        QString name;
        QString ip;
        IpEnum status;
        IpInfo() = default;
        IpInfo(QString name, QString ip, IpEnum status) : name(name), ip(ip), status(status) {}
    };

    explicit Home(QWidget *parent = nullptr);

    ~Home() override;

    // 处理信号
private slots:
    void fileOpened(const QString &chars);

    void showTable(const QVariantList &list);

    void startPing();

private:
    Ui::Home *ui;
    QVariantList *list;
};

Q_DECLARE_METATYPE(Home::IpInfo)
#endif //HOME_H
